package net.zoneland.knowledge.uom.dao;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.type.JdbcType;

import net.zoneland.knowledge.uom.model.UomDepartment;
import net.zoneland.knowledge.uom.model.UomDepartmentExample;
import net.zoneland.knowledge.uom.model.UomUser;
import net.zoneland.knowledge.uom.model.UomUserExample;

/**
 * uom人员查询接口.
 * @author zmq
 * @date 2021/8/17 14:56
 */
@Mapper
public interface UomUserOrgMapper {

    /**
     * 查询人员信息.
     * @param example 查询参数
     * @return 人员列表
     */
    @SelectProvider(type = UomUserSqlProvider.class, method = "selectByExample")
    @Results({
            @Result(column = "USERNAME", property = "userName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "COMPANYNAME", property = "companyName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "COMPANYDN", property = "companyDN", jdbcType = JdbcType.VARCHAR),
            @Result(column = "DEPARTMENTNAME", property = "deptName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "DEPARTMENTDN", property = "deptDn", jdbcType = JdbcType.VARCHAR),
            @Result(column = "ADMINORG", property = "adminOrgDN", jdbcType = JdbcType.VARCHAR),
            @Result(column = "USERID", property = "userId", jdbcType = JdbcType.VARCHAR),
            @Result(column = "EMPLOYEENUMBER", property = "userCode", jdbcType = JdbcType.VARCHAR),
            @Result(column = "EMPLOYEENUMBERNEW", property = "userCodeNew", jdbcType = JdbcType.VARCHAR),
            @Result(column = "MOBILEPHONE", property = "mobilePhone", jdbcType = JdbcType.VARCHAR),
            @Result(column = "SHORTPHONENUMBER", property = "shortPhoneNumber", jdbcType = JdbcType.VARCHAR),
            @Result(column = "MAINPHONENUMBER", property = "mainPhoneNumber", jdbcType = JdbcType.VARCHAR),
            @Result(column = "SUBPHONENUMBER", property = "subPhoneNumber", jdbcType = JdbcType.VARCHAR),
            @Result(column = "ROOMNUMBER", property = "roomNumber", jdbcType = JdbcType.VARCHAR),
            @Result(column = "EMAIL", property = "email", jdbcType = JdbcType.VARCHAR),
            @Result(column = "JOBNAME", property = "jobName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "HR_BIRTHDAY", property = "hrBirthDay", jdbcType = JdbcType.VARCHAR),
            @Result(column = "POSITIONNAME", property = "positionName", jdbcType = JdbcType.VARCHAR)
    })
    List<UomUser> queryUsersByName(UomUserExample example);

    /**
     * 查询部门信息.
     * @param example 查询参数
     * @return 组织列表
     */
    @SelectProvider(type = UomDepartmentSqlProvider.class, method = "selectDepartmentByExample")
    @Results({
            @Result(column = "DN", property = "dn", jdbcType = JdbcType.VARCHAR),
            @Result(column = "NAME", property = "name", jdbcType = JdbcType.VARCHAR),
            @Result(column = "MANAGERUSERID", property = "managerUserId", jdbcType = JdbcType.VARCHAR),
            @Result(column = "MANAGERNAME", property = "managerUserName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "COMPANYDN", property = "companyDn", jdbcType = JdbcType.VARCHAR),
            @Result(column = "COMPANYNAME", property = "companyName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "SUPERDEPTDN", property = "superDeptDn", jdbcType = JdbcType.VARCHAR)
    })
    List<UomDepartment> queryDeptsByName(UomDepartmentExample example);
}
